package org.molamil.acto.types {
	import org.molamil.acto.core.parsers.ParserError;	
	
	import flexunit.framework.TestCase;	
	
	/**
	 * @author Jorge Hernandez
	 */
	public class StringTypeParserTest extends TestCase {
		
		
		// PROPERTIES
		
		private var instance:StringTypeParser;
		
		
		// CONSTRUCTOR
		
		public function StringTypeParserTest(methodName:String = null) {
			super(methodName);
		}
		
		
		// PUBLIC METHODS
		
		override public function setUp():void {
			instance = new StringTypeParser();
		}
		
		override public function tearDown():void {
			instance = null;
		}
		
		public function testParse():void {
			
			assertEquals("'Jorge' parses to 'Jorge'", "Jorge", instance.parse("Jorge"));
			
			var s:String = "Jorge";
			var r:String = instance.parse(s);
			assertTrue("The value passed is equals to the value returned", s == r);
				
			s = "Mola";
			assertFalse("The value passed is not strictly equals to the value returned", s === r);
			
			try {
				instance.parse(null);
				fail("null should fail");
			} catch (e:ParserError) {}
			
		}
		
		
	}
}
